Skip to content

add argument task_limit for get_tasks to easily (de-)limit the amount…#1232

Closed
Chrxxxxs wants to merge 1 commit into
greenbone:mainfrom
Chrxxxxs:main
Closed

add argument task_limit for get_tasks to easily (de-)limit the amount…#1232
Chrxxxxs wants to merge 1 commit into
greenbone:mainfrom
Chrxxxxs:main

Conversation

@Chrxxxxs

@Chrxxxxs Chrxxxxs commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

... of tasks requested

What

Added the argument task_limit which adds a "rows=x" to the filter_string that is being send with the request.
If a filter_id is being used, the task_limit is being ignored.
If a filter_string is used with "rows=x", the task_limit is being ignored.
If a filter_string is used without setting the "rows" parameter, the task_limit is used.
If no filter_string is set, the task_limit is used.

Why

When using the library I didn't realise that using get_tasks() to get "all" tasks only returns 10 tasks by default. To make it easier changeable and more obvious that there is a default limit, this parameter could get added. However I can also understand if it is not necessary as it can also be manually set by using 'filter_string="rows=x"'.

Checklist

Tests are created in:

  • tests/protocols/gmp/requests/v224/test_tasks.py both for with and without a filter_string
  • tests/protocols/gmpv224/entities/tasks/test_get_tasks.py both for with and without a filter_string

@Chrxxxxs Chrxxxxs requested a review from a team as a code owner June 3, 2025 20:10
@greenbonebot greenbonebot enabled auto-merge (rebase) June 3, 2025 20:10
@github-actions

github-actions Bot commented Jun 3, 2025

Copy link
Copy Markdown

Conventional Commits Report

😢 No conventional commits found.

👉 Learn more about the conventional commits usage at Greenbone.

@bjoernricks

Copy link
Copy Markdown
Contributor

Hi, I am sorry but I am not going to merge this PR. python-gvm implements and reflects the GMP interface on a low level basis. If you want something like this just create a function or class that generates a filter string and pass it to get_tasks.

@bjoernricks bjoernricks closed this Jun 4, 2025
auto-merge was automatically disabled June 4, 2025 06:14

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants